<template>
  <router-view></router-view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { showDialog } from 'vant';
const router = useRouter()
const time = ref(localStorage.getItem('last-time'))
if (new Date().getTime() - Number(time.value) > 0) {
  setTimeout(() => {
    if (router.currentRoute.value.path !== '/login') {
      showDialog({
        title: '登录已过期',
        message: '请重新登录',
      }).then(() => {
        router.push('/login')
      });
    } else {
      localStorage.removeItem('last-time')
    }
  }, 1000);

}
</script>
<style>
html,
body,
#app {
  width: 100%;
  height: 100%;
}

body {
  font-size: 0.16rem;
}
</style>
